<template>
  <div
    :style="{
      paddingBottom: tempData.paddingBottom + 'px',
      paddingLeft: tempData.paddingTwice + 'px',
      paddingRight: tempData.paddingTwice + 'px',
      paddingTop: tempData.paddingTop + 'px',
      boxSizing: 'border-box',
    }"
  >
    <div
      :style="{
        width: '100%',
        height: '100%',
        background: '#ffffff',
        borderTopLeftRadius: tempData.radiusNumTop + 'px',
        borderTopRightRadius: tempData.radiusNumTop + 'px',
        borderBottomLeftRadius: tempData.radiusNumBottom + 'px',
        borderBottomRightRadius: tempData.radiusNumBottom + 'px',
      }"
    >
      <a-collapse class="top" v-model:active-key="list3" expand-icon-position="right">
        <a-collapse-item key="1">
          <template #header>
            <div class="box">
              <div class="line"></div>
              <div class="text">{{ compObj.title }}</div>
            </div>
          </template>
          <template #extra>
            <div></div>
          </template>
          <div class="contentBox" style="width: 100%" v-html="compObj.context"></div>
        </a-collapse-item>
      </a-collapse>
    </div>
  </div>
</template>

<script setup lang="ts">
  import { ref, watch } from 'vue'

  const props = defineProps({
    // 选中的当前组件参数
    compObj: {
      type: Object,
      default: () => {
        return {}
      },
    },
  })
  const list3 = ref(['1'])
  console.log(props)
  const tempData: any = ref({})
  watch(
    () => props.compObj,
    (newVal, oldVal) => {
      tempData.value = JSON.parse(JSON.stringify(newVal))
    },
    { immediate: true, deep: true }
  )
</script>

<style scoped lang="less">
  .box {
    display: flex;
    align-items: center;
    height: 15px;

    .line {
      width: 5px;
      height: 15px;
      margin-right: 10px;
      background-color: #40a1ff;
    }
  }
</style>
